<?php


namespace app\admin\controller\manage;


use app\common\Common;
use app\sys\model\SensitiveWord;
use think\Request;

class Sword extends Common
{
    public function listWord(Request $request)
    {
        $staffInfo = $request->_user;
        $keyWord = $request->param("keyword");
        $page = $request->param("page",0);
        $limit = $request->param("limit",10);
        $list = SensitiveWord::ListWord($staffInfo["staff_no"],$keyWord,$page,$limit);
        return successJson("success",$list);
    }

    public function addWord(Request $request)
    {
        $staffInfo = $request->_user;
        $keyWord = $request->param("keyword");
        SensitiveWord::addWord($staffInfo["staff_no"],$keyWord);
        return successJson("success");
    }

    public function upWord(Request $request)
    {
        $staffInfo = $request->_user;
        $id = $request->param("id");
        $keyWord = $request->param("keyword");
        SensitiveWord::upWord($id,$staffInfo["staff_no"],$keyWord);
        return successJson("success");
    }

    public function delWord(Request $request)
    {
        $staffInfo = $request->_user;
        $ids = $request->param("id",[]);
        if(empty($ids))return failedJson("请选择再删除~");
        SensitiveWord::DelWord($ids);
        return successJson("success");
    }
}